.Dd 2009-08-22
.Os SUNOS 5.11
.Dt NTPDATE 1M
.Sh NAME
.Nm ntpdate
.Nd set the date and time by way of NTP
.\"  EDIT THIS FILE WITH CAUTION  (ntpdate-mdoc.1M)
.\"  
.\"  It has been AutoGen-ed  Saturday August 22, 2009 at 12:34:35 AM IST
.\"  From the definitions    ntpdate.def
.\"  and the template file   agmdoc8.tpl
.Sh SYNOPSIS
.Nm  /usr/sbin/ntpdate
.Op Fl  4 Ar no
.Op Fl  6 Ar no
.Op Fl  d Ar /usr/sbin/ntpdate
.Op Fl  D Ar level
.Op Fl  c Ar driftfile
.Op Fl  g Ar threshold-value
.Op Fl  k Ar keyfile
.Op Fl  l Ar logfile
.Op Fl  L Ar /usr/sbin/ntpdate
.Op Fl  m Ar /usr/sbin/ntpdate
.Op Fl  l Ar logfile
.Op Fl  n Ar /usr/sbin/ntpdate
.Sh DESCRIPTION
.Pp 

The .Nm ntpdate
utility sets the local date and time. To determine the correct time, it polls the Network Time Protocol (NTP) servers on the hosts given as arguments. This utility must be run as root on the local host. It obtains a number of samples from each of the servers and applies the standard .Nm NTP
clock filter and selection algorithms to select the best of these. 
.Pp 

The reliability and precision of .Nm ntpdate
improve dramatically with a greater number of servers. While a single server may be used, better performance and greater resistance to inaccuracy on the part of any one server can be obtained by providing at least three or four servers, if not more. 
.Pp 

The .Nm ntpdate
utility makes time adjustments in one of two ways. If it determines that your clock is off by more than 0.5 seconds it simply steps the time by calling .Nm gettimeofday(3C).
If the error is less than 0.5 seconds, by default, it slews the clock's time with the offset, by way of a call to .Nm adjtime(2).
The latter technique is less disruptive and more accurate when the offset is small; it works quite well when .Nm ntpdate
is run by .Nm cron
every hour or two. The adjustment made in the latter case is actually 50% larger than the measured offset. This adjustment tends to keep a badly drifting clock more accurate, at some expense to stability. This tradeoff is usually advantageous. At boot time, however, it is usually better to step the time. This can be forced in all cases by specifying the .Nm -b
option on the command line. 
.Pp 

The .Nm ntpdate
utility declines to set the date if an .Nm NTP
server daemon like .Nm xntpd(1M)
is running on the same host. It can be run on a regular basis from .Nm cron(1M)
as an alternative to running a daemon. Doing so once every one to two hours results in precise enough timekeeping to avoid stepping the clock.
.Sh FILES
.Bl -tag -offset indent -compact
.It  Nm \fB/etc/inet/ntp.keys  

Contains the encryption keys used by \fBntpdate\fR.
.Sh SEE ALSO
.Pp 

.Nm cron(1M),
.Nm xntpd(1M),
.Nm adjtime(2),
.Nm gettimeofday(3C),
.Nm settimeofday(3C)\fBsyslog(3C),
.Nm 
attributes\fR(5)
.Sh BUGS

